﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Sonic.Framework.Enums;
using Sonic.Framework.Site;
using Sonic.Framework.Interfaces;
using System.IO;

namespace Sonic.Framework
{
    public class FileReferenceUpdate : IFileReferenceUpdate
    {
        public FileReferenceUpdateType FileReferenceUpdateType
        {
            get;
            set;
        }

        /// <summary>
        /// Update these files to the To file name. 
        /// This is a list for the concatenation case, a bunch of files moved into one file, and hence all need to be updated to
        /// be the new file name.
        /// </summary>
        public List<FileInfo> From
        {
            get;
            set;
        }

        /// <summary>
        /// File to update reference to match
        /// </summary>
        public FileInfo To
        {
            get;
            set;
        }

        public FileReferenceUpdate()
        {
            this.From = new List<FileInfo>();
        }

        public FileReferenceUpdate(FileReferenceUpdateType type)
        {
            this.FileReferenceUpdateType = type;
            this.From = new List<FileInfo>();
        }

        public FileReferenceUpdate(FileReferenceUpdateType type, FileInfo to)
        {
            this.FileReferenceUpdateType = type;
            this.From = new List<FileInfo>();
            this.To = to;
        }

        public FileReferenceUpdate(FileReferenceUpdateType type, FileInfo to, FileInfo from)
        {
            this.FileReferenceUpdateType = type;
            this.From = new List<FileInfo>();
            this.From.Add(from);
            this.To = to;
        }

        public FileReferenceUpdate(FileReferenceUpdateType type, FileInfo to, List<FileInfo> from)
        {
            this.FileReferenceUpdateType = type;
            this.From = new List<FileInfo>(from);
            this.To = to;
        }
    }
}
